package com.sjh.lib_app.login

import androidx.lifecycle.LiveData
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.launcher.ARouter
import com.sjh.lib_app.bean.UserBean

/**
 * 登陆功能工具类
 * @author Extends
 * @date 2020/6/12
 */
object LoginServiceWrap {
    @Autowired(name = "/login/LoginServiceImpl")
    lateinit var loginService: LoginService

    init {
        ARouter.getInstance().inject(this)
    }


    /**
     * 判断是否登陆
     */
    fun isLogin():Boolean = loginService.isLogin()

    /**
     * 跳转到登陆界面
     */
    fun startLogin() = loginService.startLogin()

    /**
     * 退出登陆
     */
    fun signOut() = loginService.signOut()

    /**
     * 获取用户信息
     */
    fun getUserInfo(): LiveData<UserBean> = loginService.getUserInfo()


}